<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" id="inp">
</body>
<script>
    //练习:取消事件
    var input = document.getElementById("inp");
    input.onfocus = function fn1() {
        alert('获得焦点');
    }

    input.onblur = function fn2() {
        alert('失去焦点');
    }
    //btn.removeEventListener('click',fn1);

    document.attachEvent('onclick' ,fn1);
    document.attachEvent('onclick' ,fn2);
    document.detachEvent('onclick' ,fn1);
</script>
</html>